package com.bw.mvvm_comom.network;

import com.bw.mvvm_comom.network.inteceptor.TokenInterceptor;

import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class TokenImpl extends BaseImpl {
    Retrofit retrofit;
    @Override
    public Retrofit getRetrofit() {
        OkHttpClient.Builder okhttpBuilder = createOkhttpBuilder();
        okhttpBuilder.addInterceptor(new TokenInterceptor());
        retrofit = new Retrofit.Builder()
                .baseUrl(Api.baseUrl)
                .client(okhttpBuilder.build())
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .build();
        return retrofit;
    }
}
